<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>发布悬赏任务 - 任务平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #4361ee;
            --secondary: #3f37c9;
            --success: #4cc9f0;
            --warning: #f72585;
            --light: #f8f9fa;
            --dark: #212529;
            --gray: #6c757d;
            --light-gray: #e9ecef;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background-color: #f0f2f5;
            color: var(--dark);
            line-height: 1.6;
        }
        
        .container {
            max-width: 800px;
            margin: 0 auto;
            padding: 0 15px;
        }
        
        /* 头部样式 */
        header {
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: white;
            padding: 15px 0;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .header-content {
            display: flex;
            align-items: center;
            padding: 0 15px;
        }
        
        .back-btn {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 15px;
            font-size: 20px;
            cursor: pointer;
        }
        
        .header-title {
            font-size: 20px;
            font-weight: bold;
        }
        
        /* 表单容器 */
        .form-container {
            background: white;
            border-radius: 15px;
            padding: 25px;
            margin: 20px 0;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
        }
        
        .form-group {
            margin-bottom: 25px;
        }
        
        .form-label {
            display: block;
            margin-bottom: 10px;
            font-weight: 600;
            font-size: 16px;
            color: var(--dark);
        }
        
        .form-control {
            width: 100%;
            padding: 14px;
            border: 1px solid var(--light-gray);
            border-radius: 10px;
            font-size: 16px;
            transition: border-color 0.3s;
        }
        
        .form-control:focus {
            border-color: var(--primary);
            outline: none;
            box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.2);
        }
        
        textarea.form-control {
            min-height: 120px;
            resize: vertical;
        }
        
        .form-hint {
            font-size: 14px;
            color: var(--gray);
            margin-top: 8px;
        }
        
        /* 预算卡片 */
        .budget-card {
            background: var(--light);
            border-radius: 12px;
            padding: 20px;
            margin-top: 10px;
        }
        
        .stage-item {
            display: flex;
            gap: 15px;
            margin-bottom: 15px;
            align-items: center;
        }
        
        .stage-item:last-child {
            margin-bottom: 0;
        }
        
        .stage-input {
            flex: 1;
        }
        
        .stage-amount {
            width: 120px;
        }
        
        .stage-action {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            background: var(--light-gray);
            color: var(--gray);
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .stage-action:hover {
            background: var(--primary);
            color: white;
        }
        
        .add-stage {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            color: var(--primary);
            cursor: pointer;
            font-weight: 500;
            margin-top: 10px;
        }
        
        .add-stage i {
            margin-right: 8px;
        }
        
        .total-budget {
            display: flex;
            justify-content: space-between;
            padding-top: 20px;
            margin-top: 20px;
            border-top: 1px dashed var(--light-gray);
            font-size: 18px;
            font-weight: bold;
        }
        
        .total-amount {
            color: var(--warning);
        }
        
        /* 位置选择 */
        .location-options {
            display: flex;
            gap: 15px;
            margin-top: 10px;
        }
        
        .location-option {
            flex: 1;
            text-align: center;
            padding: 15px;
            border: 1px solid var(--light-gray);
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.3s;
        }
        
        .location-option i {
            font-size: 24px;
            margin-bottom: 10px;
            color: var(--gray);
        }
        
        .location-option.active {
            border-color: var(--primary);
            background: rgba(67, 97, 238, 0.05);
        }
        
        .location-option.active i {
            color: var(--primary);
        }
        
        .location-option.active .location-name {
            color: var(--primary);
            font-weight: 600;
        }
        
        .location-name {
            font-size: 16px;
        }
        
        /* 要求设置 */
        .requirement-item {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }
        
        .requirement-item:last-child {
            margin-bottom: 0;
        }
        
        .requirement-checkbox {
            width: 24px;
            height: 24px;
            margin-right: 12px;
            accent-color: var(--primary);
        }
        
        .requirement-label {
            font-size: 16px;
        }
        
        /* 发布按钮 */
        .publish-btn {
            position: sticky;
            bottom: 20px;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            color: white;
            border: none;
            border-radius: 50px;
            padding: 16px;
            width: 100%;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(67, 97, 238, 0.4);
            transition: transform 0.3s;
        }
        
        .publish-btn:hover {
            transform: translateY(-3px);
        }
        
        /* 响应式设计 */
        @media (max-width: 600px) {
            .form-container {
                padding: 20px 15px;
            }
            
            .stage-item {
                flex-direction: column;
                align-items: stretch;
            }
            
            .stage-action {
                align-self: center;
            }
            
            .location-options {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <!-- 头部区域 -->
    <header>
        <div class="header-content">
            <div class="back-btn">
                <i class="fas fa-arrow-left"></i>
            </div>
            <div class="header-title">发布悬赏任务</div>
        </div>
    </header>
    
    <div class="container">
        <!-- 表单区域 -->
        <div class="form-container">
            <!-- 任务标题 -->
            <div class="form-group">
                <label class="form-label">任务标题</label>
                <input type="text" class="form-control" placeholder="例如：企业官网UI设计">
                <div class="form-hint">清晰的任务标题有助于吸引合适的执行者</div>
            </div>
            
            <!-- 任务分类 -->
            <div class="form-group">
                <label class="form-label">任务分类</label>
                <select class="form-control">
                    <option value="">请选择任务分类</option>
                    <option value="design">设计类</option>
                    <option value="it">IT技术</option>
                    <option value="writing">文案写作</option>
                    <option value="offline">线下任务</option>
                    <option value="marketing">营销推广</option>
                    <option value="other">其他</option>
                </select>
            </div>
            
            <!-- 任务描述 -->
            <div class="form-group">
                <label class="form-label">任务描述</label>
                <textarea class="form-control" placeholder="请详细描述任务需求、要求、交付标准等"></textarea>
                <div class="form-hint">描述越详细，执行者越能准确完成任务</div>
            </div>
            
            <!-- 任务阶段预算 -->
            <div class="form-group">
                <label class="form-label">任务阶段与预算</label>
                <div class="budget-card">
                    <div class="stage-item">
                        <div class="stage-input">
                            <input type="text" class="form-control" placeholder="阶段一名称" value="需求分析与原型设计">
                        </div>
                        <div class="stage-amount">
                            <input type="number" class="form-control" placeholder="金额" value="600">
                        </div>
                        <div class="stage-action">
                            <i class="fas fa-times"></i>
                        </div>
                    </div>
                    
                    <div class="stage-item">
                        <div class="stage-input">
                            <input type="text" class="form-control" placeholder="阶段二名称" value="UI视觉设计">
                        </div>
                        <div class="stage-amount">
                            <input type="number" class="form-control" placeholder="金额" value="850">
                        </div>
                        <div class="stage-action">
                            <i class="fas fa-times"></i>
                        </div>
                    </div>
                    
                    <div class="stage-item">
                        <div class="stage-input">
                            <input type="text" class="form-control" placeholder="阶段三名称" value="交付与修改">
                        </div>
                        <div class="stage-amount">
                            <input type="number" class="form-control" placeholder="金额" value="400">
                        </div>
                        <div class="stage-action">
                            <i class="fas fa-times"></i>
                        </div>
                    </div>
                    
                    <div class="add-stage">
                        <i class="fas fa-plus-circle"></i>
                        <span>添加阶段</span>
                    </div>
                    
                    <div class="total-budget">
                        <div>总预算：</div>
                        <div class="total-amount">¥1,850</div>
                    </div>
                </div>
                <div class="form-hint">任务可分1-3个阶段完成，每个阶段单独结算</div>
            </div>
            
            <!-- 截止日期 -->
            <div class="form-group">
                <label class="form-label">截止日期</label>
                <input type="date" class="form-control" value="2025-07-20">
            </div>
            
            <!-- 位置要求 -->
            <div class="form-group">
                <label class="form-label">位置要求</label>
                <div class="location-options">
                    <div class="location-option active">
                        <i class="fas fa-globe"></i>
                        <div class="location-name">远程任务</div>
                    </div>
                    <div class="location-option">
                        <i class="fas fa-map-marker-alt"></i>
                        <div class="location-name">指定位置</div>
                    </div>
                </div>
            </div>
            
            <!-- 指定位置输入 -->
            <div class="form-group" id="specific-location" style="display: none;">
                <label class="form-label">任务位置</label>
                <input type="text" class="form-control" placeholder="请输入具体位置">
            </div>
            
            <!-- 执行者要求 -->
            <div class="form-group">
                <label class="form-label">执行者要求</label>
                <div class="requirement-item">
                    <input type="checkbox" class="requirement-checkbox" checked>
                    <span class="requirement-label">必须通过实名认证</span>
                </div>
                <div class="requirement-item">
                    <input type="checkbox" class="requirement-checkbox">
                    <span class="requirement-label">需要上传相关作品证明</span>
                </div>
                <div class="requirement-item">
                    <input type="checkbox" class="requirement-checkbox">
                    <span class="requirement-label">需要相关资格证书</span>
                </div>
            </div>
            
            <!-- 平台提示 -->
            <div class="form-group" style="background: #e6f7ff; padding: 15px; border-radius: 10px;">
                <h3><i class="fas fa-info-circle" style="color: #1890ff;"></i> 平台提示</h3>
                <p style="margin-top: 10px; line-height: 1.5;">
                    根据平台规则，发布任务需要预付全额奖励金到平台账户。<br>
                    任务完成后，资金将按阶段划拨给执行者。<br>
                    平台收取服务费：普通会员15%，SVIP会员8%。
                </p>
            </div>
        </div>
        
        <!-- 发布按钮 -->
        <button class="publish-btn">预付¥1,850并发布任务</button>
    </div>
    
    <script>
        // 位置选择交互
        document.querySelectorAll('.location-option').forEach(option => {
            option.addEventListener('click', function() {
                document.querySelectorAll('.location-option').forEach(opt => {
                    opt.classList.remove('active');
                });
                this.classList.add('active');
                
                // 显示/隐藏具体位置输入框
                const specificLocation = document.getElementById('specific-location');
                if (this.querySelector('.location-name').textContent === '指定位置') {
                    specificLocation.style.display = 'block';
                } else {
                    specificLocation.style.display = 'none';
                }
            });
        });
        
        // 计算总预算
        function calculateTotal() {
            const amountInputs = document.querySelectorAll('.stage-amount input');
            let total = 0;
            
            amountInputs.forEach(input => {
                const value = parseFloat(input.value) || 0;
                total += value;
            });
            
            document.querySelector('.total-amount').textContent = '¥' + total.toLocaleString();
            document.querySelector('.publish-btn').textContent = '预付¥' + total.toLocaleString() + '并发布任务';
        }
        
        // 初始化计算
        calculateTotal();
        
        // 金额输入变化时重新计算
        document.querySelectorAll('.stage-amount input').forEach(input => {
            input.addEventListener('input', calculateTotal);
        });
        
        // 添加阶段
        document.querySelector('.add-stage').addEventListener('click', function() {
            const stageItems = document.querySelectorAll('.stage-item');
            if (stageItems.length >= 3) {
                alert('最多只能添加3个阶段');
                return;
            }
            
            const newStage = document.createElement('div');
            newStage.className = 'stage-item';
            newStage.innerHTML = `
                <div class="stage-input">
                    <input type="text" class="form-control" placeholder="阶段${stageItems.length + 1}名称">
                </div>
                <div class="stage-amount">
                    <input type="number" class="form-control" placeholder="金额">
                </div>
                <div class="stage-action">
                    <i class="fas fa-times"></i>
                </div>
            `;
            
            const budgetCard = document.querySelector('.budget-card');
            const addStageBtn = document.querySelector('.add-stage');
            budgetCard.insertBefore(newStage, addStageBtn);
            
            // 为新输入框添加事件
            newStage.querySelector('.stage-amount input').addEventListener('input', calculateTotal);
            
            // 添加删除功能
            newStage.querySelector('.stage-action').addEventListener('click', function() {
                newStage.remove();
                calculateTotal();
            });
        });
        
        // 删除阶段
        document.querySelectorAll('.stage-action').forEach(action => {
            action.addEventListener('click', function() {
                if (document.querySelectorAll('.stage-item').length <= 1) {
                    alert('至少需要一个阶段');
                    return;
                }
                
                this.closest('.stage-item').remove();
                calculateTotal();
            });
        });
        
        // 返回按钮
        document.querySelector('.back-btn').addEventListener('click', function() {
            if (confirm('确定要离开吗？您填写的内容将不会被保存')) {
                history.back();
            }
        });
        
        // 发布按钮
        document.querySelector('.publish-btn').addEventListener('click', function() {
            const title = document.querySelector('.form-group:nth-child(1) input').value;
            if (!title) {
                alert('请填写任务标题');
                return;
            }
            
            const totalAmount = parseFloat(document.querySelector('.total-amount').textContent.replace('¥', '').replace(',', ''));
            alert(`任务发布成功！\n已冻结资金：¥${totalAmount}\n请等待平台审核后开始匹配执行者`);
        });
    </script>
</body>
</html>